import { useRequest } from 'umi';
import { requestFunComponFiex } from '@/utils';
import { getBaseUrl } from '@/services/urlconst';
const baseUrl = getBaseUrl();
// 物料详情接口
export const findMaterialService = () => {
  const request: Record<string, any> = useRequest(
    (payload: Record<string, any>) => {
      if (!payload.id) return;
      const reqUrl = `${baseUrl}/materialController/details/${payload.id}`;
      return requestFunComponFiex('GET', reqUrl, {});
    },
    {
      manual: false,
      paginated: true,
      defaultPageSize: 10,
    },
  );
  return {
    findMaterialRun: (params: any) => request.run(params),
    findMaterialLoading: request.loading,
  };
};
